﻿    //查询表单
    	 $('#searchForm').form().show();
    	 var dataflag = true;
	// 请求服务器获取数据的方法
	var getPerData = function(page, rowNum, sortname, sortorder) { // 请求服务器获取数据的方法
    	$("#sys_jqGrid").jqGrid("getGridParam","rowNum");
    	$("#sys_jqGrid").jqGrid("setGridParam",{page:page});
    	rowNum = rowNum || $("#sys_jqGrid").jqGrid("getGridParam","rowNum");
        page = $("#sys_jqGrid").jqGrid("getGridParam","page");
        start = (page-1)*rowNum;
        start = start<0?0:start;
        
        queryParam = {};
        queryParam =  $('#searchForm').form('value');//序列化表格内容为字符串
        queryParam.parentModuleId = $('input[name="parentModuleId"]').attr("vId");
        fish.extend(queryParam,{page: JSON.stringify($("#sys_jqGrid").jqGrid("getGridParam","page")),
                limit : rowNum,
                start : start});
        $.ajax({
            url: webRoot+'common/sysModule/queryRecordByPageSys.do',
            async : true,
            type : 'POST',
            data :queryParam
        }).done(function(serverData, textStatus, jqXHR) {
            var data = eval("(" + jqXHR.responseText + ")");
            //jQuery("#user_jqGrid").jqGrid("reloadData",jqXHR.responseText);
            jQuery("#sys_jqGrid").jqGrid("reloadData",data);
            //jQuery("#user_jqGrid").jqGrid("reloadData",serverData);
            if(data.resultList.length==0){
				if(dataflag){
            		getPerData2(1);
            		dataflag=false;
				}
            	return;
            }
            return false;
            //return serverData;
            
        }).fail(function() {
            fish.toast('error', "网络连接失败");
        }).always(function() {
        	$.unblockUI(); 
        });
        return false;
    };
    //默认加载
    var getPerData2 = function(page, sortname, sortorder) {
	    _.delay(function(){
	        var result = getPerData(page, sortname, sortorder);
	        jQuery("#sys_jqGrid").jqGrid("reloadData",result);
	    }, 100);
	    $.blockUI({message : "数据载入中,请稍候..."});
    	return false;
	};
	$(document).ready(function() {
		$('#parentModuleId').next(".input-group-addon").click(function() {
			$("#parentModuleId").val("");
			$('input[name="parentModuleId"]').attr("vId","");
		});
		$('#resetBtn').click(function() {
			$("#parentModuleId").val("");
			$('input[name="parentModuleId"]').attr("vId","");
    });
// 所属系统，下拉树
	var parentModuleId_setting = {
		async: {
			enable: true,
			contentType: "application/json",
			url: webRoot + 'common/sysModule/queryAllForTree.do',
//			url: 'nodes.jsp',
			type: 'post'
		},
		view: {
			dblClickExpand:false,
			selectedMulti: false //如果为true,按住ctrl可以多选，false为单选 
		},
		data: {
			simpleData: {
				enable: true,
				idKey: "id",
				pIdKey: "pId",
				rootPId: 0,
				iconSkin:"icon01"
			}
		},
		callback: {
			onClick: parentModuleIdonClick
		}
	};
	
	var parentModuleIdTree = $.fn.zTree.init($("#parentModuleId_tree"), parentModuleId_setting);
	var parentModuleIdTreeObj = $.fn.zTree.getZTreeObj("parentModuleId_tree");
	function parentModuleIdonClick(){
		nodes = parentModuleIdTree.getSelectedNodes();
		if(nodes[0].children == undefined){return}//如果没有子节点就不让赋值
		var parentModuleIdInput = $('input[name="parentModuleId"]');
		// 设置控件的其他属性：vId，为真正的value
		parentModuleIdInput.attr("vId",nodes[0].id).val(nodes[0].name);
		hideparentModuleIdTree();
	};
	//下拉树相对位置，随着窗口联动
	function nodeIdTreePos(){
   		var inputObj = $('input[name="parentModuleId"]');
		var	inputObjOffSet = $('input[name="parentModuleId"]').offset();
            var $treePs = $("#parentModuleId_commbox_tree").css({left:inputObjOffSet.left + "px", top:inputObjOffSet.top + inputObj.outerHeight() + "px",width:inputObj.outerWidth() + "px",'z-index':9999});
            return $treePs;
            }
	$('input[name="parentModuleId"]').click(function(){
		nodeIdTreePos().slideDown("fast");
        $(window).resize(function(){
			nodeIdTreePos();
        });
        	$("body").bind("mousedown", onBodyDownNode);
			$.fn.zTree.init($("#parentModuleId_tree"), parentModuleId_setting);
	});
	function onBodyDownNode(event) {
		if (!(event.target.name == "parentModuleId" || event.target.id == "parentModuleId_commbox_tree" || $(event.target).parents("#parentModuleId_commbox_tree").length>0)) {
			hideparentModuleIdTree();
		}
	};
	function hideparentModuleIdTree(){
		$("#parentModuleId_commbox_tree").fadeOut("fast");
		$("body").unbind("mousedown", onBodyDownNode);
	};
	
	//查询按钮
    $('#searchBtn').click(function(e) {
        var result = getPerData(1);
        $.blockUI({message : "数据载入中,请稍候..."});
//        jQuery("#user_jqGrid").jqGrid('reloadData',result);
    });

	var sys_opt = {
		datatype: "json",
		colModel:[
					{name : 'moduleId',label : 'Id',width:100,align:'center',sortable:false}, //,hidden: true
					{name : 'parentModuleId',label : '上级业务模块Id',width:90,sortable:false,align:'center'}, //,hidden: true
					{name:'moduleLevel',label:'级别',width:80,sortable:false,align:'center'},
					{name:'moduleName',label:'业务模块名称',width:200,sortable:false,align:'center'},
					{name:'parentName',label:'上级业务模块',width:200,sortable:false,title:false,align:'center'},
					{name:'createDate',label:'创建时间',width:200,sortable:false,title:false,align:'center'},
					{name:'staffId',label:'创建员工Id',width:90,sortable:false,align:'center'},
//					{name:'staffName',label:'创建员工',width:100,sortable:false,align:'center'},
					{name:'action',label:'操作',width:80,sortable:false,align:'center',title:false}
				],
		rowNum : 10,
		rowList : [5,10,20],
		recordtext:'第{0}~{1}条/共{2}条',
    	pgtext:'第{0}页/共{1}页',
		pginput: false,//是否显示输入框
//    	viewrecords: false,//是否显示记录描述
		pager: true,
		height:'auto',
		scrollOffset:0,
		server: true,
	    jsonReader : {
            root: "resultList",// json中代表实际模型数据的入口  
            page: "page",//当前页
            total: "totalPages",// json中代表页码总数的数据  
            records: "totalRecords",//总记录数
            repeatitems: false,// 如果设为false，则jqGrid在解析json时，会根据name来搜索对应的数据元素（即可以json中元素可以不按顺序）；而所使用的name是来自于colModel中的name设定。
            cell: "cell",
            id: "moduleId"
        },
	    pageData: getPerData ,//同步场景直接用getPerData,通过 jQuery("#jqGrid01").jqGrid("reloadData",getPerData(1));加载数据;异步场景用getPerData2
		forceFit:true,  //当为ture时,调整列宽度不会改变表格的宽度
		gridview : false,
		afterInsertRow: function(e,rowid, aData){  //加载每一条数据触发的事件,可修改每一行的展示,需要设置参数gridview为false
	    	switch (aData.staffId) {
	            case session.user.id:
//	            case 10001:
				$('#sys_jqGrid').grid('setCell',rowid,'action',
				'<a href="javascript:void(0)" onclick="editRow(\''+ rowid + '\')" class="glyphicon glyphicon-edit"></a>&nbsp;&nbsp;&nbsp;&nbsp;' +
				'<a href="javascript:void(0)" onclick="delRow(\''+ rowid + '\')" class="glyphicon glyphicon-trash"></a>');
				break;
			};
		}
	};
	$sys_grid = $("#sys_jqGrid").grid(sys_opt);
    getPerData2(1);//默认加载第一页数据
    
});
	    // 点击添加按钮的事件
		$('#addBtn').click(function() {
			var $dialog;
			var tpl = '<div class="ui-dialog ui-dialogtree panel panel-default"><div class="modal-header">【业务模块添加】</div>'
				tpl += '<span class="close text-muted glyphicon glyphicon-remove"></span>'
				tpl += '<div class="panel-body">'
				tpl += '<form id="addForm" action="#" method="post" autocomplete="off">'
				tpl += '<div class="row">'
				tpl += '<div class="form-group text-right">'
				tpl += '<label for="" class="col-sm-4 control-label">业务模块名称：</label>'
				tpl += '<div class="col-sm-6  input-group">'
				tpl += '<input type="text" class="form-control" name="moduleName1"  id="moduleName1" data-rule="required" data-msg-required="计划名称不能为空"  />'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '<div class="row">'
				tpl += '<div class="form-group text-right">'
				tpl += '<label for="" class="col-sm-4 control-label">上级模块名称：</label>'
				tpl += '<div class="col-sm-6 input-group">'
				tpl += '<input type="text" class="form-control" name="parentModuleId1"  id="parentModuleId1" vId="" readOnly="true"   />'
				tpl += '<span class="input-group-addon">'
				tpl += '<span class="glyphicon glyphicon-remove"></span>'
				tpl += '</span>'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '<div class="row">'
				tpl += '<div class="form-group text-center"style="padding-top: 15px;">'
				tpl += '<button type="button" id="saveBtn" class="btn btn-primary btn-sm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;确认&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</button>'
				tpl += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" id="Cancel" class="btn btn-primary btn-sm">&nbsp;取消</button>'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '</form>'
//				tpl += '<div id="parentModuleId2_commbox_tree" class="dropdown-menu" style="position:absolute;display:none">'
//				tpl += '<div id="parentModuleId2_tree" class="ztree"></div>'
//				tpl += '</div>'
				tpl += '</div>'
				tpl += '</div>'
			$dialog = $(tpl).appendTo('body');
//			var $intput = $dialog.find('#parentModuleId1');
//			$intput.click(function(){
//				$('#parentModuleId1').clearinput();
//			});
			$('#parentModuleId1').next(".input-group-addon").click(function() {
			$("#parentModuleId1").val("");
			$('input[name="parentModuleId1"]').attr("vId","");
		});
	
			var $close = $dialog.find('.close');
			var $saveBtn = $dialog.find('#saveBtn');
			var $Cancel = $dialog.find('#Cancel');
			var $addForm = $dialog.find('#addForm');
			var moduleName1Input = $('input[name="moduleName1"]');
			var parentModuleId1Input = $('input[name="parentModuleId1"]');
			var treeisShow = false;
	$(parentModuleId1Input).click(function(){
		if(treeisShow) return
		treeisShow = true;
		var inputObj = $(parentModuleId1Input);
		var	inputObjOffSet = $(parentModuleId1Input).offset();
		var treetpl2= '<div><div id="parentModuleId1_commbox_tree" class="dropdown-menu" style="position:absolute;display:none">'
			treetpl2+= '<div id="parentModuleId1_tree" class="ztree"></div>'
			treetpl2+= '</div></div>'
		    $treediv=$(treetpl2).appendTo('body');
			var $treeBox = $treediv.find('#parentModuleId1_commbox_tree');
			var $tree = $treediv.find('#parentModuleId1_tree');
			$treeBox.css({left:inputObjOffSet.left + "px", top:inputObjOffSet.top + inputObj.outerHeight() + "px",width:inputObj.outerWidth() + "px",'z-index':9999}).slideDown("fast");
			$("body").bind("mousedown", onBodyDownNode1);
			var parentModuleId1_setting = {
			async: {
				enable: true,
				contentType: "application/json",
				url: webRoot + 'common/sysModule/queryAllForTree.do',
	//			url: 'nodes.jsp',
				type: 'post'
			},
			view: {
				dblClickExpand:false,
				selectedMulti: false //如果为true,按住ctrl可以多选，false为单选 
			},
			data: {
				simpleData: {
					enable: true,
					idKey: "id",
					pIdKey: "pId",
					rootPId: 0,
					iconSkin:"icon01"
				}
			},
			callback: {
				onClick: parentModuleId1onClick
			}
		};
		var parentModuleId1Tree = $.fn.zTree.init($tree, parentModuleId1_setting);
		var parentModuleId1TreeObj = $.fn.zTree.getZTreeObj($tree);
		function parentModuleId1onClick(){
			nodes = parentModuleId1Tree.getSelectedNodes();
			var parentModuleId1Input = $('input[name="parentModuleId1"]');
			// 设置控件的其他属性：vId，为真正的value
			parentModuleId1Input.attr("vId",nodes[0].id).val(nodes[0].name);
			hideparentModuleId1Tree();
		};
	
	});
	function onBodyDownNode1(event) {
		if (!(event.target.name == "parentModuleId1" || event.target.id == "parentModuleId1_commbox_tree" || $(event.target).parents("#parentModuleId1_commbox_tree").length>0)) {
			hideparentModuleId1Tree();
		}
	};
	function hideparentModuleId1Tree(){
		 $treediv.remove();
		 treeisShow = false;
		$("body").unbind("mousedown", onBodyDownNode1);
	};
			$dialog.dialog({
				//closeOnClickOverlay: true,
				canClose:false,
				show:true,
				width:400,
				hide:true,
				modal: true
			});

			$close.click(function(){
				$dialog.dialog('close').remove();
			});
			$saveBtn.bind('click',saveBtnEven);
			  function saveBtnEven(){
				$saveBtn.unbind('click');
			    $('#addForm').form().show();
				if($('#addForm').isValid()){
					$.blockUI({message : "数据载入中,请稍候..."});
					addParam =  $('#addForm').form('value');//序列化表格内容为字符串
					addParam.moduleName=$('input[name="moduleName1"]').val();
					if(addParam.parentModuleId1==''){
						addParam.parentModuleId = 0;
					}else{
						addParam.parentModuleId = $('input[name="parentModuleId1"]').attr("vId");
					}
//					addParam.staffId=10001;
					addParam.staffId=session.user.id;
				 $.ajax({
			            url:webRoot + 'common/sysModule/add.do',
			            type : 'POST',
			            async : true,
			            data : addParam
			        }).done(function(serverData, textStatus, jqXHR) {
						if(serverData.moduleId==0){
							fish.toast('warn', "您添加的模块名已经存在！");
						}else{
							fish.toast('success', "添加成功！");
			          	  	getPerData2(1);
						}
						return true;
			        }).fail(function() {
			            fish.toast('error', "网络连接失败");
			        }).always(function() {
			           $dialog.dialog('close').remove();
			           $saveBtn.bind('click',saveBtnEven);
			           $.unblockUI();
			        });
					}
				};
			$Cancel.click(function(){
				$dialog.dialog('close').remove();
			});
		});
		//重新编辑
		function editRow(rowid) {
			var editRow=$("#sys_jqGrid").grid("getRowData", rowid);  //获取要编辑的行数据
	        if (_.isEmpty(editRow)) 
				return;	
			var $dialog;
			var tpl = '<div class="ui-dialog ui-dialogtree panel panel-default"><div class="modal-header">【业务模块调整】</div>'
				tpl += '<span class="close text-muted glyphicon glyphicon-remove"></span>'
				tpl += '<div class="panel-body">'
				tpl += '<form id="editForm" action="#" method="post" autocomplete="off">'
				tpl += '<div class="row">'
				tpl += '<div class="form-group text-right">'
				tpl += '<label for="" class="col-sm-4 control-label">业务模块名称：</label>'
				tpl += '<div class="col-sm-6  input-group">'
				tpl += '<input type="text" class="form-control" name="moduleName2"  id="moduleName2" readOnly="true"   />'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '<div class="row">'
				tpl += '<div class="form-group text-right">'
				tpl += '<label for="" class="col-sm-4 control-label">上级模块名称：</label>'
				tpl += '<div class="col-sm-6 input-group">'
				tpl += '<input type="text" class="form-control" name="parentModuleId2"  id="parentModuleId2" vId="" readOnly="true"  />'
				tpl += '<span class="input-group-addon">'
				tpl += '<span class="glyphicon glyphicon-remove"></span>'
				tpl += '</span>'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '<div class="row">'
				tpl += '<div class="form-group text-center"style="padding-top: 15px;">'
				tpl += '<button type="button" id="editBtn" class="btn btn-primary btn-sm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;确认&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</button>'
				tpl += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button type="button" id="Cancel" class="btn btn-primary btn-sm">&nbsp;取消</button>'
				tpl += '</div>'
				tpl += '</div>'
				tpl += '</form>'
//				tpl += '<div id="parentModuleId2_commbox_tree" class="dropdown-menu" style="position:absolute;display:none">'
//				tpl += '<div id="parentModuleId2_tree" class="ztree"></div>'
//				tpl += '</div>'
				tpl += '</div>'
				tpl += '</div>'
			$dialog = $(tpl).appendTo('body');
			$('#parentModuleId2').next(".input-group-addon").click(function() {
				$("#parentModuleId2").val("");
				$('input[name="parentModuleId2"]').attr("vId","");
			});
			var $close = $dialog.find('.close');
			var $editBtn = $dialog.find('#editBtn');
			var $Cancel = $dialog.find('#Cancel');
			var $editForm = $dialog.find('#editForm');
			var moduleName2Input = $('input[name="moduleName2"]');
			moduleName2Input.val(editRow.moduleName)
			var parentModuleId2Input = $('input[name="parentModuleId2"]');
			parentModuleId2Input.attr("vId",editRow.parentModuleId).val(editRow.parentName);
			// 所属系统，下拉树
		var treeisShow = false;
	$(parentModuleId2Input).click(function(){
//		$('#parentModuleId2').clearinput();
		if(treeisShow) return
		treeisShow = true;
		var inputObj = $(parentModuleId2Input);
		var	inputObjOffSet = $(parentModuleId2Input).offset();
		var treetpl2= '<div><div id="parentModuleId2_commbox_tree" class="dropdown-menu" style="position:absolute;display:none">'
			treetpl2+= '<div id="parentModuleId2_tree" class="ztree"></div>'
			treetpl2+= '</div></div>'
		    $treediv=$(treetpl2).appendTo('body');
			var $treeBox = $treediv.find('#parentModuleId2_commbox_tree');
			var $tree = $treediv.find('#parentModuleId2_tree');
			$treeBox.css({left:inputObjOffSet.left + "px", top:inputObjOffSet.top + inputObj.outerHeight() + "px",width:inputObj.outerWidth() + "px",'z-index':9999}).slideDown("fast");
			$("body").bind("mousedown", onBodyDownNode2);
			var parentModuleId2_setting = {
			async: {
				enable: true,
				contentType: "application/json",
				url: webRoot + 'common/sysModule/queryAllForTree.do',
	//			url: 'nodes.jsp',
				type: 'post'
			},
			view: {
				dblClickExpand:false,
				selectedMulti: false //如果为true,按住ctrl可以多选，false为单选 
			},
			data: {
				simpleData: {
					enable: true,
					idKey: "id",
					pIdKey: "pId",
					rootPId: 0,
					iconSkin:"icon01"
				}
			},
			callback: {
				onClick: parentModuleId2onClick
			}
		};
		var parentModuleId2Tree = $.fn.zTree.init($tree, parentModuleId2_setting);
		var parentModuleId2TreeObj = $.fn.zTree.getZTreeObj($tree);
		function parentModuleId2onClick(){
			nodes = parentModuleId2Tree.getSelectedNodes();
			var parentModuleId2Input = $('input[name="parentModuleId2"]');
			// 设置控件的其他属性：vId，为真正的value
			parentModuleId2Input.attr("vId",nodes[0].id).val(nodes[0].name);
			hideparentModuleId2Tree();
		};
	
	});
	function onBodyDownNode2(event) {
		if (!(event.target.name == "parentModuleId2" || event.target.id == "parentModuleId2_commbox_tree" || $(event.target).parents("#parentModuleId2_commbox_tree").length>0)) {
			hideparentModuleId2Tree();
		}
	};
	function hideparentModuleId2Tree(){
		 $treediv.remove();
		 treeisShow = false;
		$("body").unbind("mousedown", onBodyDownNode2);
	};
			$dialog.dialog({
				//closeOnClickOverlay: true,
				canClose:false,
				show:true,
				width:400,
				hide:true,
				modal: true
			});

			$close.click(function(){
				$dialog.dialog('close').remove();
			});
			
//			$editBtn.click(function(){
			$editBtn.bind('click',editBtnEven);
			  function editBtnEven(){
				$editBtn.unbind('click');
				$.blockUI({message : "数据载入中,请稍候..."});
				 $('#editForm').form().show();
				eidtParam =  $('#editForm').form('value');//序列化表格内容为字符串
				eidtParam.moduleId=editRow.moduleId;
				eidtParam.moduleName=$('input[name="moduleName2"]').val();
				if(eidtParam.parentModuleId2==''){
					eidtParam.parentModuleId = 0;
				}else{
					eidtParam.parentModuleId = $('input[name="parentModuleId2"]').attr("vId");
				}
//				eidtParam.staffId=10001;
				eidtParam.staffId=session.user.id;
			 $.ajax({
		            url:webRoot + 'common/sysModule/update.do',
		            type : 'POST',
		            async : true,
		            data : eidtParam
		        }).done(function(serverData, textStatus, jqXHR) {
		        	 if(serverData.moduleId==0){
							fish.toast('warn', "您所修改的模块名已经不存在！");
					        getPerData2(1);
			        }
					else if(serverData.moduleId==-1){
							fish.toast('warn', "您修改的模块名已经存在！");
			        }
			        else if(serverData.moduleId==-2){
							fish.toast('warn', "不能将节点修改至自身及其子节点！");
			        }else{
		           		fish.toast('success', "修改成功！");
						page = $("#sys_jqGrid").jqGrid("getGridParam","page");
						recordNum = $("#sys_jqGrid").jqGrid("getGridParam","records");
						rowNum=$("#sys_jqGrid").jqGrid("getGridParam","rowNum");
						if((recordNum/rowNum)==(page-1)){
							getPerData2(1);
						}else{
						getPerData2(page);
						}
					 }
					return true;
		        }).fail(function() {
		            fish.toast('error', "网络连接失败");
		        }).always(function() {
		           $dialog.dialog('close').remove();
		           $editBtn.bind('click',editBtnEven);
		           $.unblockUI(); 
		        });
			};
			
			$Cancel.click(function(){
				$dialog.dialog('close').remove();
			});
		}
		//删除行数据
		function delRow(rowid) {
			var delrow = $("#sys_jqGrid").grid("getRowData", rowid); // 获取要删除的行数据
			if (_.isEmpty(delrow))
				return;
			fish.confirm("确定要删除吗?").result.then(function(){
				$.blockUI({message : "数据载入中,请稍候..."});
				//后台删除，将计划的状态置为00X
				$.ajax({
					url : webRoot + 'common/sysModule/delete.do',
					async : true,
					type : 'POST',
					data : {moduleId: delrow.moduleId,staffId:delrow.staffId}
				}).done(function(serverData, textStatus, jqXHR) {
					if (serverData== 0) {
						fish.toast('warn', "您所删除的模块名已经不存在！");
						getPerData2(1);
					} else if(serverData== -1){
						 fish.toast('warn', "您所删除的模块或者该模块的子模块已经创建了计划，无法删除！");
						}else {
							// 前台删除行数据，弹出提示框并刷新页面
							jQuery("#sys_jqGrid").jqGrid("delRowData", delrow);
							fish.toast('success', "删除成功！");
							page = $("#sys_jqGrid").jqGrid("getGridParam","page");
							recordNum = $("#sys_jqGrid").jqGrid("getGridParam","records");
							rowNum=$("#sys_jqGrid").jqGrid("getGridParam","rowNum");
							if((recordNum/rowNum)==(page-1)){
								getPerData2(1);
							}else{
							getPerData2(page);
							dataflag = true;
							}
						}
					return true;
				}).fail(function() {
					fish.toast('error', "网络连接失败");
				}).always(function() {
					$.unblockUI(); 
				});
			});
		}

